<%@ page import="dex.micros_gdc.Task" %>
<!DOCTYPE html>
<html>
	<head>
		<meta name="layout" content="main">
		<g:set var="entityName" value="${message(code: 'task.label', default: 'Back Task')}" />
		<title><g:message code="default.list.label" args="[entityName]" /></title>
		<g:javascript>
			$(document).ready(function()
			{
			  $("#receiveddatefrompicker").datepicker({dateFormat: 'mm/dd/yy'});
			  $("#receiveddatetopicker").datepicker({dateFormat: 'mm/dd/yy'});
			})
		</g:javascript>
	</head>
	<body>
		<a href="#list-task" class="skip" tabindex="-1"><g:message code="default.link.skip.label" default="Skip to content&hellip;"/></a>
		<div class="nav" role="navigation">
			<ul>
				<li><g:link class="list" controller="task" action="list"><g:message code="default.list.label" args="[entityName]" /></g:link></li>
			</ul>
		</div>
		<div>
			<g:form action="search" method="POST">
				<table class="search-form">
					<tbody>
						<tr>
							<td width="8%" style="vertical-align: middle;">
								<label for="projectName">
									<g:message code="task.project.label" default="Project Name" />
								</label>
							</td>
							<td width="8%">
								<g:select name="projectName" from="${projects}" style="width:200" noSelection="['':'-  Select All  -']" value="${params.projectName}"/>
							</td>
							<td width="5%" style="vertical-align: middle; text-align: right;">
								<label for="developer">
									<g:message code="task.receivedDateFrom.label" default="Received Date From" />
								</label>
							</td>
							<td width="12%">
								<g:textField name="receivedDateFrom" id="receiveddatefrompicker" value="${receivedDateFrom}"/>
							</td>
							<td width="5%" style="vertical-align: middle; text-align: right;">
								<label for="tester">
									<g:message code="task.receivedDateTo.label" default="Received Date To" />
								</label>
							</td>
							<td width="12%">
								<g:textField name="receivedDateTo" id="receiveddatetopicker" value="${receivedDateTo}"/>
							</td>
							<td width="12%">
								<label for="Status">
									<g:message code="task.project.label" default="Status" />
								</label>
							</td>
							<td width="14%">
								<g:select name="ts" from="${Task.constraints.status.inList}" style="width:120" noSelection="['':'-  Select All  -']" value="${params.ts}"/>
							</td>
							<td width="4%" style="vertical-align: middle;">
								<label for="ActionType">
									<g:message code="task.project.label" default="Action Type" />
								</label>
							</td>

							<td width="20%">
								<g:select name="at" from="${Task.constraints.actionType.inList}" style="width:120" noSelection="['':'-  Select All  -']" value="${params.at}"/>
							</td>
						</tr>
						<tr>
							<td width="8%" style="vertical-align: middle;">
								<label for="developer">
									<g:message code="task.developer.label" default="Developer" />
								</label>
							</td>
							<td width="8%">
								<g:select name="developer" from="${developers}" style="width:200px" noSelection="['':'-  Select All  -']" value="${params.developer}"/>
							</td>
							<td width="5%" style="vertical-align: middle; text-align: right;">
								<label for="tester">
									<g:message code="task.tester.label" default="QA" />
								</label>
							</td>
							<td width="12%">
								<g:select name="tester" from="${testers}" style="width:200px" noSelection="['':'-  Select All  -']" value="${params.tester}"/>
							</td>
							<td width="5%" style="vertical-align: middle; text-align: right;">
								<label for="tester">
									<g:message code="task.close.label" default="Closed" />
								</label>
							</td>
							<td width="12%">
								<g:select name="closed" from="${Task.constraints.testByGDCFlag.inList}" style="width:120px" noSelection="['':'-  Select All  -']" value="${params.closed}"/>
							</td>
							<td width="12%">
								<label for="Find">
									<g:message code="task.find.label" default="Find" />
								</label>
							</td>
							<td width="14%">
								<g:textField name="findId" maxlength="20" value="${findId}" size="10"/>
							</td>
							<td width="4%"/>
							<td align="left" width="20%">
								<g:submitButton name="search" class="search-button" value="${message(code: 'default.button.search.label', default: 'Search')}" />
							</td>
						</tr>
					</tbody>
				</table>
			</g:form>
		</div>
		<g:set var="pN" value="${params.projectName}" />
		<g:set var="dev" value="${params.developer}" />
		<g:set var="qa" value="${params.tester}" />
		<g:set var="cf" value="${params.closed}" />
		<g:set var="from" value="${params.receivedDateFrom}" />
		<g:set var="to" value="${params.receivedDateTo}" />
		<g:set var="pts" value="${params.ts}" />
		<g:set var="fid" value="${params.findId}" />
		<g:set var="ats" value="${params.at}" />
		<div id="list-task" class="content scaffold-list" role="main">
			<table>
				<thead>
					<tr>
						<th><g:message code="task.reopen.label" default="Action" /></th>

						<g:sortableColumn property="projectName" params="[projectName:[pN], developer:[dev], tester:[qa], closed:[cf], receivedDateFrom:[from], receivedDateTo:[to], ts:[pts], findId:[fid], at:[ats]]" title="${message(code: 'task.projectName.label', default: 'Project')}"/>

						<g:sortableColumn property="activityNumber" params="[projectName:[pN], developer:[dev], tester:[qa], closed:[cf], receivedDateFrom:[from], receivedDateTo:[to], ts:[pts], findId:[fid], at:[ats]]" title="${message(code: 'task.activityNumber1.label', default: 'Act #')}" />

						<g:sortableColumn property="feedbackNumber" params="[projectName:[pN], developer:[dev], tester:[qa], closed:[cf], receivedDateFrom:[from], receivedDateTo:[to], ts:[pts], findId:[fid], at:[ats]]" title="${message(code: 'task.feedbackNumber.label', default: 'FB #')}" />

						<g:sortableColumn property="actionType" params="[projectName:[pN], developer:[dev], tester:[qa], closed:[cf], receivedDateFrom:[from], receivedDateTo:[to], ts:[pts], findId:[fid], at:[ats]]" title="${message(code: 'task.actionType.label', default: 'AType')}" />

						<g:sortableColumn property="documentType" params="[projectName:[pN], developer:[dev], tester:[qa], closed:[cf], receivedDateFrom:[from], receivedDateTo:[to], ts:[pts], findId:[fid], at:[ats]]" title="${message(code: 'task.documentType1.label', default: 'DType')}" />

						<g:sortableColumn property="receivedDate" params="[projectName:[pN], developer:[dev], tester:[qa], closed:[cf], receivedDateFrom:[from], receivedDateTo:[to], ts:[pts], findId:[fid], at:[ats]]" title="${message(code: 'task.receivedDate.label', default: 'Rec Date')}" />

						<g:sortableColumn property="dueDate" params="[projectName:[pN], developer:[dev], tester:[qa], closed:[cf], receivedDateFrom:[from], receivedDateTo:[to], ts:[pts], findId:[fid], at:[ats]]" title="${message(code: 'task.dueDate.label', default: 'Due Date')}" />

						<g:sortableColumn property="completedDate" params="[projectName:[pN], developer:[dev], tester:[qa], closed:[cf], receivedDateFrom:[from], receivedDateTo:[to], ts:[pts], findId:[fid], at:[ats]]" title="${message(code: 'task.completedDate.label', default: 'Com Date')}" />

						<g:sortableColumn property="status" params="[projectName:[pN], developer:[dev], tester:[qa], closed:[cf], receivedDateFrom:[from], receivedDateTo:[to], ts:[pts], findId:[fid], at:[ats]]" title="${message(code: 'task.status.label', default: 'Status')}" />

						<g:sortableColumn property="rootCause" params="[projectName:[pN], developer:[dev], tester:[qa], closed:[cf], receivedDateFrom:[from], receivedDateTo:[to], ts:[pts], findId:[fid], at:[ats]]" title="${message(code: 'task.rootCause.label', default: 'Root Cause')}" />

						<g:sortableColumn property="developer" params="[projectName:[pN], developer:[dev], tester:[qa], closed:[cf], receivedDateFrom:[from], receivedDateTo:[to], ts:[pts], findId:[fid], at:[ats]]" title="${message(code: 'task.developer.label', default: 'Dev')}" />

						<g:sortableColumn property="tester" params="[projectName:[pN], developer:[dev], tester:[qa], closed:[cf], receivedDateFrom:[from], receivedDateTo:[to], ts:[pts], findId:[fid], at:[ats]]" title="${message(code: 'task.tester.label', default: 'QA')}" />

						<g:sortableColumn property="description" params="[projectName:[pN], developer:[dev], tester:[qa], closed:[cf], receivedDateFrom:[from], receivedDateTo:[to], ts:[pts], findId:[fid], at:[ats]]" title="${message(code: 'task.description.label', default: 'Description')}" />

					</tr>
				</thead>
				<tbody>
				<g:each in="${taskInstanceList}" status="i" var="taskInstance">
					<tr class="${(i % 2) == 0 ? 'even' : 'odd'}">

						<g:if test="${taskInstance.closedFlag.equals('Y')}">
							<td><g:link action="reopen" id="${taskInstance.id}" params="[projectName:[pN], developer:[dev], tester:[qa], closed:[cf], receivedDateFrom:[from], receivedDateTo:[to], ts:[pts], findId:[fid], at:[ats]]"><g:message code="task.reopen.label" default="Re-Open" /></g:link></td>
						</g:if>
						<g:else>
							<td><g:link action="close" id="${taskInstance.id}" params="[projectName:[pN], developer:[dev], tester:[qa], closed:[cf], receivedDateFrom:[from], receivedDateTo:[to], ts:[pts], findId:[fid], at:[ats]]"><g:message code="task.close.label" default="Close" /></g:link></td>
						</g:else>

						<td>${fieldValue(bean: taskInstance, field: "projectName")}</td>

						<td>${fieldValue(bean: taskInstance, field: "activityNumber")}</td>

						<td>${fieldValue(bean: taskInstance, field: "feedbackNumber")}</td>

						<td>${fieldValue(bean: taskInstance, field: "actionType")}</td>

						<td>${fieldValue(bean: taskInstance, field: "documentType")}</td>

						<td><g:formatDate date="${taskInstance.receivedDate}" format="MM/dd/yyyy"/></td>

						<td><g:formatDate date="${taskInstance.dueDate}" format="MM/dd/yyyy"/></td>

						<td><g:formatDate date="${taskInstance.completedDate}" format="MM/dd/yyyy"/></td>

						<td>${fieldValue(bean: taskInstance, field: "status")}</td>

						<td>${fieldValue(bean: taskInstance, field: "rootCause")}</td>

						<td>${fieldValue(bean: taskInstance, field: "developer")}</td>

						<td>${fieldValue(bean: taskInstance, field: "tester")}</td>

						<td>${fieldValue(bean: taskInstance, field: "description")}</td>

					</tr>
				</g:each>
				</tbody>
			</table>
			<div class="pagination">
				<g:paginate total="${taskInstanceTotal}" action="list" params="[projectName:[pN], developer:[dev], tester:[qa], closed:[cf], receivedDateFrom:[from], receivedDateTo:[to], ts:[pts], findId:[fid], at:[ats]]"/>
			</div>
			<g:if test="${taskInstanceTotal > 0}">
				<export:formats formats="['excel']" params="[projectName:[pN], developer:[dev], tester:[qa], closed:[cf], receivedDateFrom:[from], receivedDateTo:[to], ts:[pts], findId:[fid], at:[ats]]"/>
			</g:if>
			</div>
	</body>
</html>
